#ifndef __DATAGRAM_BUILDER_H__
#define __DATAGRAM_BUILDER_H__ 1

#include <string>

#include "packet_source.h"
#include "stegio.h"
#include "properties_reader.h"

/**
 * @brief datagram builder for communication
 * @author mnutzinger, jwurzer
 */
class CDatagramBuilder : public IPacketSource
{
public:
	CDatagramBuilder(CPropertiesReader* pConfig, IStegIO* pStegIO);
	virtual ~CDatagramBuilder();

	virtual NPacketSource::EPayloadInfo getPacket(void*& pPacket, unsigned int& pPacketLength,
			unsigned int pMaxLength);
	virtual void putPacket(void* pPacket, unsigned int pPacketLength);

private:
	CDatagramBuilder(const CDatagramBuilder& );
	CDatagramBuilder& operator=(const CDatagramBuilder& );

	static const std::string sIniSectionName;

	CPropertiesReader* mConfig;
	IStegIO* mStegIO;

	unsigned char* mByteBuffer;
	unsigned int mByteBufferSize;

	unsigned char* getByteBuffer(unsigned int pSize);
};

#endif // __DATAGRAM_BUILDER_H__

